#include <stdio.h>
#include <math.h>
int main()
{
    int i, x, y, last = 1;
    printf("input X and Y(X**Y):");
    scanf("%d**%d", &x, &y);
    for (i = 1; i <= y; i++)
    {
        last = last * x % 1000;
        
    }
    printf(" the last 3 digits of %d**%dis:%d\n", x, y, last % 1000);
    return 0;
}